﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Business.WEB;
using DataAccess;
using Model;

namespace AirlinePilotAcedemy_WEB
{
    public partial class ActualSubjects : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (!User.Identity.IsAuthenticated)
                {
                    Response.Redirect("Login.aspx?");
                }
                User user = UserDataAccess.GetUserByUsername(User.Identity.Name);
                Student student = StudentDataAccess.GetOneStudentByID(user.Ci);

                GridView1.DataSource = ViewSubjectsManager.ViewMySubjects(student);
                DataBind();

            }
        }

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row = GridView1.SelectedRow;
            Response.Redirect("ViewScores.aspx?codMateria="+ row.Cells[2].Text + "&nameSubject="+ row.Cells[3].Text + "&month=" + row.Cells[4].Text);
        }
    }
}